﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Text</title>
    <link href="~/Scripts/jquery-easyui-1.5.4/themes/bootstrap/easyui.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-easyui-1.5.4/jquery.min.js"></script>
    <script src="~/Scripts/jquery-easyui-1.5.4/jquery.easyui.min.js"></script>
    <script src="~/Scripts/jquery-easyui-1.5.4/locale/easyui-lang-zh_CN.js"></script>
    <link href="~/Content/themes/icon.css" rel="stylesheet" />
    <script src="~/Content/js/common.js"></script>
    <link href="~/Content/themes/table.css" rel="stylesheet" />
</head>
<body>
    <div>
        <form id="importFileForm" enctype="multipart/form-data">
            <table class="tableForm" width="100%">
                <tbody>
                    <tr>
                        <th>
                            资料路径：
                        </th>
                        <td>
                            <input type="file"  id="fileImport" name="fileImport" style="width:260px;">
                            <a id="uploadFile" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="#">上传</a>
                        </td>

                </tbody>
            </table>
        </form>
    </div>
</body>
</html>
<script type="text/javascript">
    $('#uploadFile').bind('click', function () {

        alert('111');

       
    //// file对象
    //var file = $('#fileImport').files[0];
    ////判断控件中是否存在文件内容，如果不存在，弹出提示信息，阻止进一步操作
    //if (file == null) { alert('错误，请选择文件'); return; }

    ////获取文件名称
    //var fileName = file.name;
    ////获取文件类型名称
    //var file_typename = fileName.substring(fileName.lastIndexOf('.'), fileName.length);
        var p = $("#importFileForm");
    //获取form数据
    var formData = new FormData(p[0]);

    $.ajax({
    url: "/Document/UploadFile",
    type: 'POST',
    data: formData,
    async: false,
    cache: false,
    contentType: false,
    processData: false,
    success: function (returnInfo) {
    alert(1);
    },
    error: function (returnInfo) {
    alert(0);
    }
    });

    }); 
</script>